-- msg_scout_explore_bonus
-- Create by panyl
-- 斥候探索数据

return function(lpc)
    if not ScoutM.isExploring() then
       return;
    end

    local bonus  = lpc.bonus;
    local totalBonus = ScoutM.queryOriBonus();
    local updated = false;
    for index, m in pairs(totalBonus) do
        if m["class_id"] == bonus["class_id"] and m["count"] == bonus["count"] then
            totalBonus[index] = bonus;
            updated = true;
            break;
        end
    end

    if not updated then
        table.insert(totalBonus, 1, bonus);
    end

    local uiScoutInfo = UIMgr:getCurrentScene():getFormByName("UIScoutInfo");
    if uiScoutInfo ~= nil then
        local classId = bonus["class_id"];
        -- 修正金钱Id
        if classId == "money" then
            local unit = bonus["count"] / ScoutM.queryExplore("scout_count");
            if unit == 1000 then
                classId = 1509;
            elseif unit == 200 then
                classId = 1508;
            else
                classId = 1507;
            end
        end
        -- 需要播放物品跳出来的动画
        uiScoutInfo:setItemOutClassId(classId);
    end

    -- 更新
    ScoutM.updateExploreBonus(totalBonus);

    -- 抛出事件用于更新主地图提示
    EventMgr.fire(event.WORKSHOP_INFO_UPDATED);
end
